<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<div>
    <input type="text" placeholder="请输入0-100之间的整数" v-model="num">
    <input type="button" value="猜一下" @click="f()">
    <h1>{{info}}</h1>
</div>
<!--引入VUE-->
<script src="https://cdn.jsdelivr.net/npm/vue@2/dist/vue.js"></script>
<script>
    let e = parseInt(Math.random()*101)
    let v = new Vue({
        el:"div",
        data:{
            info:"测试结果",
            num:""
        },
        methods:{
            f:function () {
                if (e > v.num){
                    v.info="猜小了"
                }else if (v.num > e){
                    v.info="猜大了"
                }else {
                    v.info="猜对了"
                }
            }
        }
    })
</script>
</body>
</html>